--[[
	Galactica
	File: cl_init.lua
]]

include("shared.lua")

Galactica = {}
Galactica.Client = {}
Galactica.Client.Money = "Updating..."
Galactica.Client.Version = "Updating..."
Galactica.Client.TextColor = Color(255, 255, 255, 255)

function GM:HUDPaint()
	self.BaseClass:HUDPaint()
	
	surface.SetDrawColor(0, 0, 0, 150)
	surface.DrawRect(0, 0, ScrW(), 25)	
	
	--draw.RoundedBox(5, 0, 0, ScrW(), 25, Color(0, 0, 0, 150))
	
	draw.DrawText("Galactica Version "..tostring(Galactica.Client.Version), "ScoreboardText", 5, 4, Galactica.Client.TextColor, 0)
	draw.DrawText("Money: "..tostring(Galactica.Client.Money), "ScoreboardText", 200, 4, Galactica.Client.TextColor, 0)
	
	local tr = util.TraceLine(util.GetPlayerTrace(LocalPlayer()))
	local Owner = "N/A"
	if(tr.HitNonWorld) then
		if(tr.Entity:IsValid() and !tr.Entity:IsPlayer() and !LocalPlayer():InVehicle()) then
			if(tr.Entity:GetNetworkedString("Galactica.Protections.Owner") == "") then
				Owner = "World"
			else			
				Owner = tr.Entity:GetNetworkedString("Galactica.Protections.Owner")
			end
		end
	end
	draw.DrawText("Prop Owner: "..tostring(Owner), "ScoreboardText", 350, 4, Galactica.Client.TextColor, 0)
end

function GalacticaDataUpdateClient(um)
	Galactica.Client.Money = um:ReadShort()
	Galactica.Client.Version = um:ReadShort()
end
usermessage.Hook("GalacticaDataUpdateClient", GalacticaDataUpdateClient) 
